import request from '@/utils/request/request';
import type { UserInfo, UpdateProfileParams, UpdatePasswordParams } from '@/types/user';
import type { CommonResponse } from '@/types/response';

// 获取用户信息
export const getInfo = (): Promise<CommonResponse<UserInfo>> => request.get('/getInfo');

// 更新用户信息
export const updateUserProfile = (params: UpdateProfileParams): Promise<CommonResponse<UserInfo>> => 
  request.put('/system/user/profile', params);

// 更新用户头像
export const uploadAvatar = (file: File): Promise<CommonResponse<{ avatarUrl: string }>> => 
  request.uploadFile('/system/user/profile/avatar', file);

// 用户密码重置
export const updateUserPwd = (params: UpdatePasswordParams): Promise<CommonResponse<void>> => 
  request.put('/system/user/profile/updatePwd', {}, params);